﻿using PgBirdie.Core.Model.Database.Structure;

namespace PgBirdie.Core.Service.Compare
{
    public interface ICompareService
    {
        /// <summary>
        /// Checks if source and target dbs have differences between tables.
        /// </summary>
        bool TablesHaveDifferences(PgDatabase source, PgDatabase target);
        
        /// <summary>
        /// Checks if source and target dbs have differences in static data.
        /// Returns false even if structure is different but static data is identical between dbs. 
        /// </summary>
        bool StaticDataHaveDifferences(PgDatabase source, PgDatabase target);

        /// <summary>
        /// Checks if source and target dbs have differences between sequences.
        /// </summary>
        bool SequencesHaveDifferences(PgDatabase source, PgDatabase target);

        /// <summary>
        /// Checks if source and target dbs have differences in access control (OWNER/GRANT/REVOKE).
        /// </summary>
        bool AccessControlHasDifferences(PgDatabase source, PgDatabase target);

        /// <summary>
        /// Checks if source and target dbs have differences in owners (OWNER).
        /// </summary>
        bool OwnersHaveDifferences(PgDatabase source, PgDatabase target);

        /// <summary>
        /// Checks if source and target dbs have differences in privileges (GRANT/REVOKE).
        /// </summary>
        bool PrivilegesHaveDifferences(PgDatabase source, PgDatabase target);        

        bool ColumnPropertiesMatch(PgColumn source, PgColumn target);
        bool ColumnTypePropertiesMatch(PgColumn source, PgColumn target);
        bool ColumnTableNameMatch(PgColumn source, PgColumn target);
        bool ColumnDataTypeMatch(PgColumn source, PgColumn target);
        bool ColumnIsNullableMatch(PgColumn source, PgColumn target);
        bool ColumnSequenceMatch(PgColumn source, PgColumn target);        
    }
}